C (182/301)

From:Allan Odgaard
Date:15 Aug 99 at 20:09:10
Subject:Re: Font sizes.

From: Allan Odgaard <Duff@DIKU.DK>

On 15-Aug-99, Lee Atkins wrote:

> Is there a way of getting the size of a font Text() will use before opening
> a window?

Yes, TextLength() from graphics.library. You could use it like this:

struct RastPort rport;
InitRastPort(&rport);
SetFont(&rport, default_font);
ULONG len = TextLength(&rport, str, strlen(str));

Regards Allan



URL: http://www.DIKU.dk/students/duff/


Everything should be made as simple as possible, but not simpler.
-- Albert Einstein